﻿using ChurchDiary.BLL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ChurchWebsite.ReportViewer
{
    public partial class ReportDataViewer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["ChurchWorkerId"] != null)
                    {
                        Guid ChurchWorkerId = new Guid(Request.QueryString["ChurchWorkerId"]);
                        rvDataViewer.Reset();
                        DataTable dt = new BLL_ChurchWorker().GetChurchWorkerFullDetailsSet(ChurchWorkerId);
                        rvDataViewer.LocalReport.ReportPath = "Reports/ChurchWorker/RptChurchWorker.rdlc";
                        rvDataViewer.LocalReport.DataSources.Clear();
                        rvDataViewer.LocalReport.DataSources.Add(new ReportDataSource("ChurchWorker", dt));
                        rvDataViewer.DataBind();
                        rvDataViewer.LocalReport.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
}